<?php

namespace App\Console\Commands;

use App\Http\Model\WishDefender;
use App\Http\Services\WishDefenderServices;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;

class WishDefenderCountdown extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'WishDefenderCountdown';

    protected $wishDefenderModel;
    protected $wishDefenderServices;


    protected $log = 'wish_defender_countdown';//日志
    protected $error_log = 'error_wish_defender_countdown';
    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '擂主倒计时';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->wishDefenderModel = new WishDefender();
        $this->wishDefenderServices = new WishDefenderServices();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        ini_set('memory_limit', '-1');
        do{
            $this->wishDefenderServices->winnerCountdownHandle();
        }while(true);
    }
}